import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { path } from  'path'
//const path = require('path')
import { resolve } from 'path'

export default defineConfig({
  plugins: [vue()],
  server: {
    port: 8080,
    host: false,
    proxy: {
      '/api': {
        target: 'http://localhost:3000', // 后端服务器地址
        changeOrigin: true, // 改变请求头中的 Origin
        pathRewrite: {
          '^/api': '' // 重写路径，去掉 /api 前缀
        }
      }
    }
  }

})